package com.example.service.impl;

import com.example.pojo.Product;
import com.example.service.ProductService;
import org.springframework.stereotype.Service;

import java.util.ArrayList;
import java.util.Arrays;
import java.util.List;

/**
 * @author yinyin
 * @create 2021/07/14 下午 3:04
 */
@Service
public class ProductServiceImpl implements ProductService {
    @Override
    public List<Product> selectProductList() {
        return Arrays.asList(
                new Product(1,"华为手机",1,5000D),
                new Product(2,"联想电脑",1,5000D),
                new Product(3,"小米手环",1,249D)

        );
    }

    @Override
    public List<Product> selectProductListByIds(List<Integer> ids) {
        ArrayList<Product> products = new ArrayList<>();
        ids.forEach(id ->products.add(new Product(id,"电视机"+id,1,3999D)));
        return products;
    }

    @Override
    public Product selectProductById(Integer id) {
        return new Product(id,"拯救者Y9000P",1,14999D);
    }
}
